package com.zhuang.adapter.objectadapter;

/**
 * @Classname VoltageAdapter
 * @Description 适配器类
 * @Date 2021/3/21 14:33
 * @Created by dell
 */

public class VoltageAdapter implements Voltage5V {

    private Voltage220V voltage220V;

    public VoltageAdapter(Voltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }

    @Override
    public int output5V() {
        //获取交流电220V
        int output220V = voltage220V.output220V();
        //转为5V
        int output5V = output220V / 44;
        System.out.println("VoltageAdapter 输出5伏");
        return output5V;
    }
}
